package com.sxpi.upload.properties;

import lombok.Data;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @Author: 董伟豪
 * @Date: 2022/10/25 18:56
 */
@Data
@ConfigurationProperties(prefix = "cos.upload2")
public class CosProperties2 implements CommandLineRunner {

    private String appId;
    private String secretId;
    private String secretKey;
    private String regionPublic;
    private String bucketPublic;

    /**
     * SpringBoot加载完毕以后，就会来执行的一个方法，当这个方法执行以后，那么以后的所有地方都可以使用
     * @param args
     * @throws Exception
     */
    @Override
    public void run(String... args) throws Exception {
        CosParamter.appId = this.getAppId();
        CosParamter.secretId = this.getSecretId();
        CosParamter.secretKey = this.getSecretKey();
        CosParamter.bucketPublic = this.getBucketPublic();
        CosParamter.regionPublic = this.getRegionPublic();
    }
}
